<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态时钟</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            flex-direction: column;
            font-family: Arial, sans-serif;
        }
        h1 {
            margin-bottom: 20px;
        }
        #clock {
            font-size: 2em;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <h1>当前时间</h1>
    <div id="clock"></div>

    <script>
        function updateClock() {
            const clockElement = document.getElementById('clock');
            const now = new Date();
            const hours = String(now.getHours()).padStart(2, '0');
            const minutes = String(now.getMinutes()).padStart(2, '0');
            const seconds = String(now.getSeconds()).padStart(2, '0');
            clockElement.textContent = `${hours}:${minutes}:${seconds}`;
        }

        // 初始化时钟
        updateClock();

        // 每秒更新一次时钟
        setInterval(updateClock, 1000);
    </script>
</body>
</html>